{"ast":null,"code":"export var getUserName=function getUserName(user){if(user.firstName&&user.lastName){return\"\".concat(user.firstName,\" \").concat(user.lastName);}return user.firstName||user.lastName||user.nickname;};var normalFakeModelProfile=function normalFakeModelProfile(){return{id:'0',email:'test@test.com',nickname:'nicknameTest',firstName:'firstNameTest',lastName:'lastNameTest',verified:true,hideEmail:false,content:{items:[{id:'0',link:'string',avatar:true}]}};};export var profileCompletionPercentage=function profileCompletionPercentage(profile){var _profile$content;var maxPointer=Object.keys(normalFakeModelProfile()).length+1;var pointer=0;Object.values(profile).forEach(function(item){if(typeof item!==null&&typeof item!=='undefined'){pointer++;}});if(profile.content&&((_profile$content=profile.content)===null||_profile$content===void 0?void 0:_profile$content.items.length)>0){pointer++;}return pointer===0?0:pointer/maxPointer*100;};","map":{"version":3,"names":["getUserName","user","firstName","lastName","nickname","normalFakeModelProfile","id","email","verified","hideEmail","content","items","link","avatar","profileCompletionPercentage","profile","maxPointer","Object","keys","length","pointer","values","forEach","item"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/utils/User.ts"],"sourcesContent":["import {UserListItem} from \"../models/response/UserListItem\";\n\nexport const getUserName = (user: UserListItem): string => {\n    if (user.firstName && user.lastName) {\n        return `${user.firstName} ${user.lastName}`;\n    }\n\n    return user.firstName || user.lastName || user.nickname;\n}\n\nconst normalFakeModelProfile = (): UserListItem => {\n    return ({\n        id: '0',\n        email: 'test@test.com',\n        nickname: 'nicknameTest',\n        firstName: 'firstNameTest',\n        lastName: 'lastNameTest',\n        verified: true,\n        hideEmail: false,\n        content: {\n            items: [\n                {\n                    id: '0',\n                    link: 'string',\n                    avatar: true,\n                }\n            ]\n        }\n    });\n}\n\nexport const profileCompletionPercentage = (profile: UserListItem): number => {\n    const maxPointer: number = Object.keys(normalFakeModelProfile()).length + 1;\n    let pointer: number = 0;\n\n    Object.values(profile).forEach((item) => {\n        if (typeof item !== null && typeof item !== 'undefined') {\n            pointer++;\n        }\n    });\n\n    if (profile.content && profile.content?.items.length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